home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr08 / batsh151.zip / BATSH.TXT < prev    next >
Text File  |  1995-02-12  |  13KB  |  313 lines

  1.             Welcome to BATSH version 1.5
  2.             ----------------------------
  3.  
  4. Usage:    To run Windows commands from a file. Line by Line.
  5. ------    Like BATCH (.BAT) files in DOS, but with some windows
  6.           specific commands, and not all the DOS features.
  7.           For WINDOWS 3.1
  8.  
  9. Install:
  10. --------
  11. Place the files BATSH.EXE and BATSH.TXT anywhere on the disk.
  12. Then write with notepad a text file with one command per line.
  13.   (See below a description of available commands.)
  14. Give the text file an extension .BSH and associate with
  15. File-Manager the program BATSH.EXE. [File - Associate...].
  16.   (Include the exact program location in the association.)
  17. Run your new command-file with a double click. 
  18.  
  19. To install your command-file in Program-Manager, you can drag the
  20. file with the mouse from File-Manager to a Program-Manager group.
  21. For this procedure, both File- and Program-Manager must be visible
  22. on the windows screen.
  23.  
  24. License:
  25. --------
  26. I give this program away for free. 
  27. It's features will never reach the standard of a commercial
  28. product, but it may suit you, if you need a few commands only.
  29. You are not allowed to modify the program, sell it, or use it
  30. as part of a commercial software package.
  31. The Author has no warranty, obligations or liability for any problems
  32. that may be encountered using this program.
  33. The latest version is available from ftp.fmi.ch
  34.  
  35.  
  36. Commands:
  37. ---------
  38. Parameters in [] brackets are marked as optional, for using the
  39. option, you must type it without the brackets.
  40. For commands returning an ERRORLEVEL, the value for successful 
  41. operation is 0, 
  42.  
  43. ASK var txt 
  44.    (let the user assign a value to a variable.)
  45.    (The old value of an existing variable is given as default.)
  46.    txt - message
  47.    var - variable name to assign response.( For the variable
  48.          $PASSWORD, typed characters are shown as *.)
  49.    return value - errorlevel 2 if empty
  50.  
  51. CHOICE k1,k2,k3 txt
  52.    (select by different keys  -with errorlevel returned- )
  53.    (not exactly the DOS 6.x equivalent)
  54.    (k1 is the default key on time-out -errorlevel 1-)
  55.    (you must mention the options in the text message.)
  56.    (the keys are not shown)
  57.    k1-k9 - a key letter (k1 is the default key)
  58.            (never case sensitive)
  59.    txt   - message
  60.    return value - errorlevel according to the position on the 
  61.                   command line: k1 ->1  k2 ->2 ....
  62.  
  63.    special keys: $S Space     
  64.                  $E Enter
  65.                  $A any other key -except ALT- that is not in the key list
  66.                  # and number - time-out value in seconds 
  67.  
  68. CLOSE txt
  69.    (close window with title -txt- [with save])
  70.     txt     :substring of a window title
  71.     return value - errorlevel 2 if window not found
  72.  
  73. COPY file1 file2 
  74.     (copy files - single files only)
  75.     file1,file2   - full filename
  76.     ! existing files will be overwritten
  77.     ! compressed (MS compress) files will be expanded
  78.     return value - errorlevel 2 if file not found
  79.                    errorlevel 3 for copy errors
  80.  
  81. DEL file
  82.     (delete a file - single file only)
  83.     ! if possible, access restrictions are reset before deletion
  84.     return value -  errorlevel 2 if file not found
  85.                     errorlevel 3 for file access errors
  86.  
  87. EXACT sw
  88.    (all txt parameters are treated case sensitive by default)
  89.     sw   ON   (default)
  90.          OFF
  91. EXIT
  92.    (stop processing and quit BATSH.EXE.
  93.  
  94. file
  95.    (run a DOS or WINDOWS program -including PIF and BAT files)
  96.     file    :program filename with optional startup parameters
  97.     return value - errorlevel 2 if file not found
  98.                    >2 for other errors
  99.     if wait is on, processing waits for launched program to close
  100. GOTO txt 
  101. :txt
  102.    (jump with processing to line :txt, never case sensitive)
  103.  
  104. ICON [file]
  105.    (change the icon image) 
  106.    file: (optional) the first icon from this file is loaded.
  107.          without file parameter, the default BATSH icon is assigned.
  108.          WINDOWS default icons are loaded with the reserved words
  109.            STOP
  110.            INFO
  111.            EXCLAMATION
  112.            QUESTION
  113.    return value - errorlevel 2 if file not found. 
  114.                   errorlevel 3 if icon is invalid. 
  115.  
  116. IF [not] condition statement
  117.    (specify the conditions under which a statement will be executed)
  118.    conditions:
  119.       ERRORLEVEL number - true for equal or higher errorlevel
  120.       EXIST file  (the first matching name will be assigned to the
  121.                    variable $FILE )
  122.       NETPORT dev (check if the devicename -dev- is a remote device.
  123.                    The network name is returned in the variable $NET)
  124.                    dev   : device name  LPT1-9 or D:-Z:
  125.                    errorlevel 2 if network not installed or
  126.                                 network-error
  127.       REMOTE txt  (substring of a remote service 
  128.                    returns the corresponding device name in $NET)
  129.                    errorlevel 2 if network not installed or
  130.                                 network-error
  131.       WINDOW 'window title substring' in quotes if it includes spaces
  132.       string1==string2  - compare two strings
  133.    statement :BATSH command
  134. LABEL txt
  135.    (change the title of the BATSH.EXE icon)
  136.    txt     :new title    no txt  :filename of running script file as title (default)
  137.  
  138. MESSAGE [lbl]
  139.    txt
  140.    [txt]
  141. .[lblok],[sec]
  142.    (multiple lines of text txt are displayed.)
  143.    lbl   - messagebox title (default MESSAGE)
  144.    txt   - single or multiple text lines.
  145.             a line should not be longer than 50 characters
  146.             variables get translated 
  147.    .     - the end of the message lines.
  148.             until here, all lines are treated as message.
  149.    the end-line must start with a dot (with optional parameters)
  150.    lblok - The default button label is OK.
  151.             You may type your own label.
  152.    sec   - optional time-out value in seconds.
  153.  
  154. NETADD dev txt [pass]
  155.     (new connection or reconnect)
  156.     dev   : device name  LPT1-LPT9 or D:-Z: ?:
  157.               ?: takes the first free disk name for connection
  158.                  and returns the connected drive name in $NET
  159.     txt   : connection string
  160.     pass  : optional password
  161.     return value - errorlevel >0 for various network errors
  162. NETSTOP [QUIT] dev
  163.     (stop network connection)
  164.     dev   : device name  LPT1-9 or D:-Z:
  165.     QUIT  : use this keyword to ignore open files and print-jobs
  166.             forced disconnection
  167.     return value - errorlevel >0 for various network errors
  168. PLAY file
  169.    (play WAVE soundfile)
  170.     return value - errorlevel 2 if file not found
  171. PRINT file    !! file gets deleted !!
  172.    (print a print-file to the windows defined default printer)
  173.    file    -name of a file with raw-data.
  174.    return value - errorlevel 2 if file not found
  175.    !! The file is deleted automatically after printing.
  176.       If you want to keep it, you must copy it first.
  177.    !! This function is using PRINT-Manager. Some strange printer
  178.       drivers do not print with the spooler active, and can therefore
  179.       not be used with this command. 
  180. PRINTER # txt
  181.    (set windows default printer)
  182.    #    number 1..9  - Output port LPT1: - LPT9:
  183.    txt  substring of an installed printer driver
  184.    return value - errorlevel 2 if printer driver not found
  185.                   or printer not defined
  186.  
  187. QUIT txt
  188.    (quit window with title -txt- [w/o save])
  189.    txt     :substring of a window title
  190.    return value - errorlevel 2 if window not found
  191. REM  txt  
  192. ; txt
  193.    (3 types of comment lines, including empty lines)
  194.     txt     :comment
  195. RESTART
  196.    (restart windows)
  197.     return value - errorlevel 2 if an application refuses to close
  198. RUN [sw] txt
  199.    (to define the display status at startup of a program) 
  200.    (-some programs use their on startup display status- )
  201.     sw (optional)
  202.        hide :start program -txt- hidden
  203.        icon :start program -txt- as icon
  204.     txt     :program file name and optional parameters
  205.     return value - errorlevel 2 if file not found 
  206.                    >2 for other errors
  207.     if wait is on, processing waits for launched program to close
  208.  
  209. SET var=txt - set variable to value txt
  210. SET var=    - remove variable
  211.  
  212. SHOW sw txt
  213.    ( modify the display status of an existing window)
  214.     sw  HIDE 
  215.         NORMAL
  216.         ICON      
  217.     txt      :substring of a window title
  218.     no txt - the BATSH.EXE icon is hidden or visible
  219.     return value - errorlevel 2 if window not found
  220. WAIT sw  
  221.    (general wait on/off toggle or wait for a specific event)
  222.     sw - ON   (default) wait for launched programs to be closed
  223.          OFF 
  224.          DROP - wait until a file is dropped on BATSH-icon
  225.            The filename is returned in the variable $DROP.
  226.            A hidden BATSH icon is made visible before the wait.
  227.            For multiple files, the name of the first is kept.  
  228.          time in seconds - wait processing 
  229. WAITCLOSE [sec] txt
  230.    (wait until window -txt- is closed.)
  231.    (if more than one match, the first is monitored)
  232.     sec      :time-out in seconds (optional)
  233.     txt      :substring of a window title
  234.     return value - errorlevel 2 if window not found
  235.                    errorlevel 3 if time-out reached.
  236. WAITOPEN [sec] txt
  237.    (wait until window -txt- is open.)
  238.     sec      :time-out in seconds (optional)
  239.     txt      :substring of a window title
  240.     return value - errorlevel 2 if window is already open
  241.                    errorlevel 3 if time-out reached.
  242.  
  243.  
  244. Special Environment variables:
  245. ------------------------------
  246. BATSH variables can be at any place on a line
  247. Before executing a command all text-parts with %1 - %9 
  248. are replaced with the corresponding commandline parameters.
  249. %var%  is replaced with a predefined variable or a set variable.
  250. All variables are stored in uppercase. Values may have lower-
  251. and upper-case text.
  252.  
  253. $FILE     - this variable is set from an IF EXIST command 
  254. $DROP     - the first file-name from a WAIT DROP command
  255. $PASSWORD - when set with the ASK command, typed characters
  256.             are shown as *.
  257. $HELP     - default: BATSH.TXT
  258. $CLOSE    - nothing
  259.             The variable $HELP and $CLOSE define a file or a program
  260.             that activates, when the user selects the corresponding
  261.             menu option. Programs (not files) may have parameters.
  262.             The parameters get converted to upper case.
  263.             You can disable the help option by setting $HELP to empty.
  264.             The file BATSH.TXT should be read-only if the default TXT
  265.             file viewer allows editing.
  266. $INSTANCE - 1 if no other BATSH.EXE program is running. 
  267. $NET      - device name from an IF REMOTE or NETADD ?: command.
  268.           - network name from an IF NETPORT command.
  269. $$var     - variables with $$ are kept in WINDOWS memory (global).
  270.                they can be accessed from each instance of the
  271.                BATSH.EXE program, and get deleted only when
  272.                WINDOWS is stopped or when they are set to
  273.                empty with the command SET $$var= 
  274.             limitation: the global space is 256 characters only
  275.                for names and assigned values.  
  276.  
  277. all the DOS environment variables are defined at startup
  278.  
  279.  
  280. Hints:
  281. ------
  282. BATSH command files are called from within a BATSH file
  283.   with the command: BATSH.EXE file-name. If WAIT is on (default),
  284.   processing waits for the branched BATSH file to return.
  285. Be careful with searching window titles.
  286.   The procedure:   LABEL Waiting to close Clock 
  287.                    WAITCLOSE Clock              
  288.   is waiting for the BATSH icon closing and not for the Clock
  289.   program.
  290. For using printer-ports LPT4 - LPT9 for network printing, BATSH 
  291.   will add missing devices to the [ports] section of WIN.INI.
  292.   For these devices, a network printer must be reconnected
  293.   before each print job.
  294. For missing DOS commands you can use BATSH to run DOS 
  295.   batch-files. 
  296.   To hide running DOS commands you must create a PIF file.
  297.   Define the BAT file as ' display windowed' and 'close
  298.   on exit'. Use the BATSH command RUN HIDE or RUN ICON to
  299.   activate the PIF file. If you give the PIF file the same
  300.   name as the BAT file, you can RUN the BAT file directly.
  301. For more windows control you can run recorded macros.
  302.   Use the windows supplied recorder and record a macro.
  303.   Assign it a shortcut key and store the macro in a file.
  304.   Run the macro from BATSH as RECORDER -H key macro-file.
  305.   
  306.  
  307. ----------------------------------------------------------------
  308.     Thomas Nyffenegger, FMI, PoBox 2543, 4002 Basel, CH
  309.     Email: nyffenegger@fmi.ch
  310.  
  311. ----------------------------------------------------------------
  312.  
  313.